****
** Replication File:
**
** The Relationship between Social Media Use and 
** Beliefs in Conspiracy Theories and Misinformation
**
** 2020 March data
****

set more off

* Install cortesti
ssc install cortesti

* Set working directory

* Open March 2020 data
use "Clean Data, March 2020.dta"

********************************************************************************

****
** Table 1
****

foreach v of var cpurpose onepercent deepstate falseflag rothschilds ///
	jfk aids epstein cellphone replaceworkers aliens ///
	vaccines smallgroup jewskilled gmos{
	gen belief_`v' = 0
	replace belief_`v' = 1 if `v' > 3 & `v' < .
}

sum belief_cpurpose-belief_gmos

********************************************************************************

****
** Estimates for Figure 2
** (Stored in "Beliefs by Medium, March.csv")
****

mean number if nattv == 1
mean number if localtv == 1
mean number if radio == 1
mean number if newspaper == 1
mean number if web == 1
mean number if socmedia == 1  

* Social media vs. web
ttesti 427 6.203747 4.388224 492 5.182927 4.286942
ttesti 427 6.203747 4.388224 77 6 5.296474
ttesti 427 6.203747 4.388224 63 4.380952 3.997695
ttesti 427 6.203747 4.388224 450 4.326667 3.98633
ttesti 427 6.203747 4.388224 447 4.232662 3.823987

* QAnon thermometer
mean qanonft if nattv == 1
mean qanonft if localtv == 1
mean qanonft if radio == 1
mean qanonft if newspaper == 1
mean qanonft if web == 1
mean qanonft if socmedia == 1 

ttesti 325 32.06462 29.68849 340 23.75588 28.37396
ttesti 325 32.06462 29.68849 57 35.61404 34.43044
ttesti 325 32.06462 29.68849 43 27.11628 29.77312
ttesti 325 32.06462 29.68849 307 20.79479 26.13052
ttesti 325 32.06462 29.68849 296 21.18581 25.22528

********************************************************************************

****
** Estimates for Figure 3
** (Stored in "Correlations, March.csv")
****

sem (<- number facebook), standardize
sem (<- number instagram), standardize
sem (<- number twitter), standardize
sem (<- number reddit), standardize
sem (<- number chans), standardize
sem (<- number youtube), standardize

cortesti .158845 2023 .2058925 2021
cortesti .158845 2023 .227833  2022
cortesti .158845 2023 .2629415 2023
cortesti .158845 2023 .3964181 2022
cortesti .158845 2023 .2320535 2023

* QAnon
sem (<- qanonft facebook), standardize
sem (<- qanonft instagram), standardize
sem (<- qanonft twitter), standardize
sem (<- qanonft reddit), standardize
sem (<- qanonft chans), standardize
sem (<- qanonft youtube), standardize

cortesti .1475612 1418 .1907416 1418

********************************************************************************

****
** Model estimates for Table 1 and marginal
** effects for panel A of Figure 4 (stored
** in "Marginal Effects, March.csv")
****

reg number socmedia conthink pid ideo interest ///
	edu age income female black hispanic	
est sto mod1

reg number socialmedia socmedia conthink pid ideo ///
	interest edu age income female black hispanic	
est sto mod2

reg number c.socialmedia##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
est sto mod3	
margins, dydx(socialmedia) at(conthink=(1(.5)5))

* Save model estimates
esttab mod1 mod2 mod3 using "Number Estimates, March.rtf", ///
	label cells(b(star fmt(3)) se(par fmt(3))) legend ///
	stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)

****
** Model estimates for Table 1 and Table A3,  
** and marginal effects for panel B of 
** Figure 4 (stored in "Marginal Effects, QAnon.csv")
****

reg qanonft socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est sto mod4

reg qanonft socialmedia socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est sto mod5

reg qanonft c.socialmedia##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
est sto mod6	
margins, dydx(socialmedia) at(conthink=(1(.5)5))

* Save model estimates
esttab mod4 mod5 mod6 using "QAnon Estimates, March.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)
	
********************************************************************************

****
** Table A1
****

sum age, detail
sum income, detail
sum female
sum white
sum black
sum hispanic

****
** Table A2
****

sum pid
sum ideo 
sum attend	

********************************************************************************	
	
****
** Table A4, estimates for Figure A1
** (stored in "Marginal Effects, March Tobit.csv")
****

tobit number socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est store mod7	

tobit number socialmedia socmedia conthink pid ideo interest ///
	edu age income female black hispanic	
est store mod8	

tobit number c.socialmedia##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
est store mod9
margins, dydx(socialmedia) at(conthink=(1(.5)5))

* Save model estimates
esttab mod7 mod8 mod9 using "Number Estimates, March (Tobit).rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: Tobit coefficients with standard errors in parentheses)

****
** Table A5, estimates for Figure A1
** (stored in "Marginal Effects, March Tobit.csv")
****	

tobit qanonft socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est store mod10	

tobit qanonft socialmedia socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est store mod11	

tobit qanonft c.socialmedia##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic	
est store mod12	
margins, dydx(socialmedia) at(conthink=(1(.5)5))

* Save model estimates
esttab mod10 mod11 mod12 using "QAnon Estimates, March (Tobit).rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: Tobit coefficients with standard errors in parentheses)	
	
********************************************************************************	
	
****
** Table A18 
****	

alpha cpurpose-gmos, gen(conscale)
		
reg conscale socialmedia socmedia conthink pid ideo interest ///
	edu age income female black hispanic
est store mod13	

reg conscale c.socialmedia##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
est store mod14	
		
****
** Table A18 
****

foreach v of var cpurpose-gmos{
	gen con_`v' = `v'
}	

reshape long con_, i(responseid) string j(whichcon)

mixed con_ socmedia socialmedia conthink pid ideo interest edu age ///
	income female black hispanic || responseid:	
est store mod15	
	
mixed con_ c.socmedia##c.conthink c.socialmedia##c.conthink pid ideo ///
	interest edu age income female black hispanic || responseid:			
est store mod16	

drop _est*
reshape wide	

* Save model estimates
esttab mod13 mod14 mod15 mod16 using "Alternative Estimates, March.rtf", ///
	cells(b(star fmt(3)) se(par fmt(3))) legend label ///
	varlabels(_cons Constant) stats(r2 N, fmt(3 0 1)) ///
	addnotes(Note: OLS coefficients with standard errors in parentheses)	
	
********************************************************************************		
	
****
** Footnote 3
****

* Number of conspiracy beliefs
reg number c.facebook##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg number c.instagram##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg number c.twitter##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg number c.reddit##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic	

reg number c.chans##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic		
	
* QAnon support
reg qanonft c.facebook##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg qanonft c.instagram##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg qanonft c.twitter##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic
	
reg qanonft c.reddit##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic	

reg qanonft c.chans##c.conthink c.socmedia##c.conthink ///
	pid ideo interest edu age income female black hispanic			
	

clear
